package com.ruoyi.common.utils.payment.pbqzpay;

import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.utils.MD5Util;

public class PubuPayUtils {

    public static String key = "5e5ffe14a51f470ba309493692c43b19";


    public static String getSign(long time, JSONObject jsonObject,String token){
        String sign = "";
        StringBuffer sb = new StringBuffer();
        sb.append("time").append(time).append("token").append(token.replaceAll(":",""));
        jsonObject.keySet().forEach(key -> {
            Object value = jsonObject.get(key);
            sb.append(key).append(value.toString().replaceAll("-",""));
        });
        sb.append(key);
        sign = MD5Util.stringMD5(sb.toString()).toLowerCase();
        return sign;
    }
}
